package Util::Leimu::Leimu;
use Moose;
use namespace::autoclean;

has 'schema' => (
	is => 'rw',
	required => 1,
	isa => 'DBIx::Class::Schema',
);

sub get_all {
	my ($self) = @_;
	return $self->schema->resultset('Leimu')->all();
}

sub create {
	my ($self, $cid, $name) = @_;
	my $leimu = $self->schema->resultset('Leimu')->create({
		cid => $cid,
		name => $name
	});
	return $leimu;
}

sub get_leimu_by_cid{
        my ($self, $cid) = @_;
        return $self->schema->resultset('Leimu')->search(
                        {
                                'cid' => $cid},
                        {});

}

__PACKAGE__->meta->make_immutable;

1;
